package com.kyzh.core.activities

import android.content.Intent
import android.os.Bundle
import com.gushenge.atools.util.getStatusBarHeight
import com.gushenge.atools.util.setMargins
import com.gushenge.core.base.activity.BaseActivity
import com.gushenge.core.dao.MMKVConsts
import com.gushenge.core.toast
import com.kyzh.core.R
import com.kyzh.core.utils.dip
import kotlinx.android.synthetic.main.activity_auth.*
//sdk使用  不要更换路径
class AuthActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_auth)
        initView()
    }

    private fun initView() {

        btCancel.setOnClickListener {
            finish()
        }
        btCancel.setMargins(0, dip(12) + getStatusBarHeight(), dip(24), 0)
    }

    override fun onResume() {
        super.onResume()
        auth.setOnClickListener {
            if (MMKVConsts.uid.isNotEmpty()){
                val intent = Intent()
                intent.putExtra("uid", MMKVConsts.uid)
                setResult(100, intent)
                finish()
            }else{
                "请先打开${resources.getString(R.string.app_name)}登录后使用".toast()
                finish()
            }
        }
    }
}
